package dyyx.dto;

import java.util.concurrent.atomic.AtomicLong;

/**
 * @author dugang 时间打点统计数据对象
 */
public class TimeInfo {

    /**
     * 时间等于0的个数
     */
    public final AtomicLong zeroCount   = new AtomicLong(0);
    public final AtomicLong sum         = new AtomicLong(0);
    public final AtomicLong count       = new AtomicLong(0);

    // count great than 100ms
    public final AtomicLong countGt100  = new AtomicLong(0);
    public final AtomicLong countGt200  = new AtomicLong(0);
    public final AtomicLong countGt500  = new AtomicLong(0);
    public final AtomicLong countGt1000 = new AtomicLong(0);

    private long            max;
    /**
     * 当前时间
     */
    private long            current;

    /**
     * 最大耗时对应的时间点
     */
    private long            maxTime;

    public long getAvg() {
        long counttmp = this.count.get();
        long sumtmp = this.sum.get();
        return sumtmp / counttmp;
    }

    public long getMax() {
        return max;
    }

    public void setMax(long max) {
        this.max = max;
    }

    public long getCurrent() {
        return current;
    }

    public void setCurrent(long current) {
        this.current = current;
    }

    public long getMaxTime() {
        return maxTime;
    }

    public void setMaxTime(long maxTime) {
        this.maxTime = maxTime;
    }

}
